home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Games / Arashi 1.1.1 / source code / Game Source / jam src / Helpsystem.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-02-17  |  1.6 KB  |  95 lines  |  [TEXT/KAHL]

  1. /*
  2. **    Helpsystem.c
  3. **    HPYTerm
  4. **    Copyright ©Juri Munkki 1987
  5. */
  6.  
  7. static    int            hpage;
  8. static    DialogPtr    hdialog;
  9.  
  10. DrawHelp(page)
  11. int    page;
  12. {
  13.     RgnHandle
  14.             savedclip;
  15.     Handle    hpict;
  16.     Rect    destrect;
  17.     Rect    itemrect;
  18.     long    Garbage;
  19.     int        x,y;
  20.  
  21.     savedclip=NewRgn();
  22.     GetClip(savedclip);
  23.  
  24.     GetDItem(hdialog,4,&Garbage,&Garbage,&itemrect);
  25.     ClipRect(&itemrect);
  26.     EraseRect(&itemrect);
  27.     x=(itemrect.right+itemrect.left)>>1;
  28.     y=(itemrect.top+itemrect.bottom)>>1;
  29.  
  30.     hpict=GetResource('PICT',page);
  31.     HLock(hpict);
  32.     destrect=*(Rect *)(*hpict+2);
  33.     OffsetRect(&destrect,
  34.         x-((destrect.right-destrect.left)>>1)-destrect.left,
  35.         y-((destrect.bottom-destrect.top)>>1)-destrect.top);
  36.     
  37.     DrawPicture(hpict,&destrect);
  38.  
  39.     SetClip(savedclip);
  40.     DisposeRgn(savedclip);
  41.     ReleaseResource(hpict);
  42. }
  43. void    SetButtons()
  44. {
  45.     Handle    picth;
  46.     Rect    grect;
  47.     ControlHandle
  48.             controlh;
  49.  
  50.     SetResLoad(0);
  51.     GetDItem(hdialog,3,&grect,&controlh,&grect);
  52.     picth=GetResource('PICT',hpage-1);
  53.     if(picth)
  54.         HiliteControl(controlh,0);
  55.     else
  56.         HiliteControl(controlh,255);
  57.  
  58.     GetDItem(hdialog,2,&grect,&controlh,&grect);
  59.     picth=GetResource('PICT',hpage+1);
  60.     if(picth)
  61.         HiliteControl(controlh,0);
  62.     else
  63.         HiliteControl(controlh,255);
  64.     SetResLoad(-1);
  65. }
  66. void    MoreInfo()
  67. {
  68.     int        hit;
  69.     GrafPtr    saved;
  70.     
  71.     GetPort(&saved);
  72.     hpage=1000;
  73.     hdialog=GetNewDialog(1001,0,(WindowPtr)-1);
  74.     SetPort((GrafPtr)hdialog);
  75.     DrawHelp(hpage);
  76.     SetButtons();
  77.     do
  78.     {    ModalDialog(0L,&hit);
  79.         switch(hit)
  80.         {    case 2:
  81.                 hpage+=1;
  82.                 SetButtons();
  83.                 DrawHelp(hpage);
  84.                 break;
  85.             case 3:
  86.                 hpage-=1;
  87.                 SetButtons();
  88.                 DrawHelp(hpage);
  89.                 break;
  90.         }
  91.     }    while(hit!=1);
  92.     DisposDialog(hdialog);
  93.     SetPort(saved);
  94. }
  95.